home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / clang / ebksrc.zip / PCVIDEO.HPP < prev    next >
C/C++ Source or Header  |  1991-07-30  |  2KB  |  67 lines

  1. /*
  2.  
  3.     pcvideo.hpp
  4.     7-30-91
  5.     Extended text attribute control for conio.
  6.  
  7.     Copyright 1991
  8.     John W. Small
  9.     All rights reserved
  10.     Use freely but acknowledge authorship and copyright.
  11.  
  12.     PSW / Power SoftWare
  13.     P.O. Box 10072
  14.     McLean, Virginia 22102 8072 USA
  15.     
  16.     John Small
  17.     Voice: (703) 759-3838
  18.     CIS: 73757,2233
  19.  
  20. */
  21.  
  22. #ifndef PCVIDEO_HPP
  23. #define PCVIDEO_HPP
  24.  
  25. #include <conio.h>
  26.  
  27. // Construct various text attributes.
  28. #define rvideo(attr)  \
  29.     ((((attr) & 0x07) << 4) | ((attr) & 0x08) |  \
  30.     (((attr) & 0x70) >> 4) | ((attr) & 0x80))
  31. #define bvideo(attr)  ((attr) | 0x80)
  32. #define ubvideo(attr) ((attr) & 0x7F)
  33. #define lvideo(attr) ((attr) & 0xF7)
  34. #define hvideo(attr) ((attr) | 0x08)
  35. #define svideo(fgrd, bgrd) ((fgrd) + (bgrd) * 16)
  36.  
  37. // Set various text attributes.
  38. #define setvideo(fgrd,bgrd) textattr(svideo(fgrd,bgrd))
  39. extern  void reversevideo();
  40. extern  void blinkvideo();
  41. extern  void unblinkvideo();
  42. extern  void savevideo();
  43. extern  void restorevideo();
  44. extern  void saveAsOrigVideo();
  45. extern  void restoreOrigVideo();
  46. extern  void putvideo(int left, int top, int right,
  47.         int bottom, int attr, int buf[]);
  48.  
  49. // handy text mode items
  50. extern  int  istext();
  51. extern  int  iscolor();
  52. extern  void toggleRes();  // C80/C4350
  53. extern  int  forcedmonochrome;
  54.  
  55. // automatic monochrome/color palettes
  56. typedef int Palette[];
  57. typedef int *PalettE;
  58. #define PalettE0 ((PalettE)0)
  59. inline  void mappalette(PalettE P)
  60.         { if (P)  P[0] = iscolor(); }
  61. inline  int  mapattr(int attr_id, PalettE P)  {
  62.         return (P? P[(attr_id)*2-1+P[0]]
  63.         : svideo(BLINK+WHITE,RED)); }
  64. extern  void mapvideo(int attr_id, PalettE P);
  65.  
  66. #endif
  67.